entry: make sure priv->current_pos is valid
authorTimm Bäder <mail@baedert.org>
Mon, 6 Mar 2017 17:41:12 +0000 (18:41 +0100)
committerTimm Bäder <mail@baedert.org>
Mon, 13 Mar 2017 11:08:58 +0000 (12:08 +0100)
We can e.g. get the entry dispose()d and a focus_out event after that
(because the toplevel unsets the focus which previously was the entry).
We then later use priv->current_pos in a call to pango API which makes
sure the given index is valid for the given layout. Since we lazily
create a GtkEntryBuffer in get_buffer() and a PangoLayout lazily in
gtk_entry_create_layout, these 2 are always valid but don't match
priv->current_pos in this situation.

Fix this by resetting priv->current-pos in dispose().

gtk/gtkentry.c

index 261e97f289cd74fcbd348b54f4e6af1576db9681..dded3b8f0e8e1cf501b30a5f18737a78d0dd22c7 100644 (file)
@@ -2664,6 +2664,8 @@ gtk_entry_dispose (GObject *object)
   gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
   gtk_entry_set_completion (entry, NULL);
 
+  priv->current_pos = 0;
+
   if (priv->buffer)
     {
       buffer_disconnect_signals (entry);